//
//  UIButton+Extension.swift
//  SinaWeibo
//
//  Created by 李江波 on 2016/11/13.
//  Copyright © 2016年 lijiangbo. All rights reserved.
//

import UIKit

extension UIButton {

     convenience init(title : String,backImageName : String,titleColor : UIColor) {
        self.init()
        
        self.setTitle(title, for: .normal)
        self.setTitleColor(titleColor, for: .normal)
        self.setBackgroundImage(UIImage(named: backImageName), for: .normal)
    
    }
    
    convenience init(title : String,ImageName : String,titleColor : UIColor) {
        self.init()
        
        self.setTitle(title, for: .normal)
        self.setTitleColor(titleColor, for: .normal)
        self.setImage(UIImage(named: ImageName), for: .normal)
    }
    
    convenience init(title : String,bgImageName : String,bgHighlightImageName : String, bgDisbleImageName : String, titleColor : UIColor ) {
        self.init()
        
        self.setTitle(title, for: .normal)
        self.setTitleColor(titleColor, for: .disabled)
        self.setTitleColor(UIColor.darkGray, for: .normal)
        self.setBackgroundImage(UIImage(named: bgImageName), for: .normal)
        self.setBackgroundImage(UIImage(named: bgHighlightImageName), for: .highlighted)
        self.setBackgroundImage(UIImage(named: bgDisbleImageName), for: .disabled)
        self.sizeToFit()
    }
}
